Skip to content

feat(cli): enable cancellable scans over MCP - #682

Open
kmbroai wants to merge 2 commits into
mainfrom
dev/kyleb/mcp-scans
Open

feat(cli): enable cancellable scans over MCP#682
kmbroai wants to merge 2 commits into
mainfrom
dev/kyleb/mcp-scans

Conversation

@kmbroai

@kmbroai kmbroai commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

MCP clients can currently inspect CLI metadata but cannot run security scans. This change exposes a scan tool through codex-security --mcp, so another agent can run scans and receive structured results without invoking a shell command for each scan.

Changes

  • Merge main at 3f3aa8e9 into the scan branch, preserving its mock scans, workflow reuse, authentication, budget controls, and canonical plugin packaging.
  • Reuse the existing CLI scan schemas, option mapping, and execution path for standard, Deep, path, and Git diff scans, including dry runs.
  • Use the MCP SDK directly to forward request cancellation, cancel active scans on disconnect or server shutdown, and wait for runtime cleanup. Keep diagnostics on stderr and protocol messages on stdout.
  • Handle cancellation for zero and empty-string request IDs, including cancellation before tool validation completes, and retain stdout error handling until the output stream closes.
  • Return each scan's { exitCode, data?, error? } outcome, preserving findings when coverage is incomplete or a severity policy fails. Keep concurrent requests independent.
  • Keep patching, PR creation, and other commands outside the MCP scan tool. Update metadata, MCP registration diagnostics, documentation, and installed-package smoke coverage.

Testing

  • 211 focused CLI, MCP, mock-scan, and authentication tests passed with zero failures. MCP regressions cover the merged mock/workflow options and noninteractive budget behavior.
  • Generated-model consistency, MCP and SDK TypeScript checks, package formatting, and git diff --check: passed.
  • Portable plugin Ruff checks and source compatibility checks: passed.
  • Production build and complete packed/installed npm package validation: passed, including MCP scan preflight, native Node lifecycle and terminal contracts, dashboard assets, and 122 bundled plugin files (398 archive entries).
  • Three independent native reviews and independent verification of the exact merge commit: passed.

Tests use synthetic fixtures; no billable scans or external publication were performed.

Risk and rollout

This adds the scan tool to the existing stdio --mcp interface; existing CLI flags and defaults remain unchanged. MCP scan arguments use camelCase option names and exclude patch, patchSeverity, and createPr. info.scanMcp now reports true.

The server runs locally with its configured credentials and filesystem access. Scans may incur model costs, write artifacts, and run repository tools. Clients must allow enough time for scans and use cancellation to stop unwanted work. No network listener or separate service is introduced. The direct MCP SDK dependency uses the version already present through Incur.

Public disclosure review

  • No customer, partner, prospect, or user identities, data, or identifying details are included.
  • No credentials, personal data, private source, scan findings, or nonpublic links or tickets are included.
  • I reviewed the branch name, title, description, commits, changes, comments, logs, screenshots, attachments, and links for public disclosure.

@github-actions github-actions Bot added the enhancement New feature or request label Aug 27, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review Completed 2026-09-01T23:57:27.510431Z 60f5d6d New commits

Security findings

Blocking findings (1)

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Security Review

Here are some automated security review suggestions for this pull request.

Reviewed commit: b109ea3440

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Comment thread sdk/typescript/src/cli.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant